package com.mmc.service.sys.impl;

import java.util.Date;
import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mmc.domain.sys.SysUser;
import com.mmc.mapper.sys.SysUserMapper;
import com.mmc.service.sys.SysUserService;
import com.mmc.utils.MmcConstants;
@Service
@Transactional
public class SysUserServiceImpl implements SysUserService{
	@Autowired
	private SysUserMapper sysUserMapper;

	@Override
	public List<SysUser> getAllUser() {
		return this.sysUserMapper.getAllUser();
	}

	@Override
	public void saveUser(SysUser sysUser,Date operDate) {
		sysUser.setId(UUID.randomUUID().toString());
		sysUser.setStatus(MmcConstants.SYSTEM_YESORNO_NO);
		sysUser.setCreateTime(new Date());
		sysUser.setOperDate(operDate);
		sysUser.setDelFlag(MmcConstants.SYSTEM_YESORNO_NO);
	}

	@Override
	public void updateUser(SysUser sysUser) {
		this.updateUser(sysUser);
	}

	@Override
	public void deleteUsers(String[] ids) {
		for (int i = 0; i < ids.length; i++){
			this.deleteUser(ids[i]);
		}
	}

	@Override
	public SysUser getById(String id) {
		return this.getById(id);
	}

	@Override
	public void deleteUser(String id) {
		this.deleteUser(id);
	}
	
}
